package com.power.sifa.approve.model;


import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
*  决定类型实体类
*/

@Entity
@ApiModel(value="决定类型")
@Data
@Table(name="Apl_decistiontype",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Apl_decistiontype.Apl_decistiontypePK.class) 用于复合组件
public class Apl_decistiontype extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "apl_decistiontype")
    @SequenceGenerator(name = "apl_decistiontype", sequenceName = "APL_DECISTIONTYPE", allocationSize = 1)
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private Integer id;

    @ApiModelProperty(value = "父层级id")
    private Integer parentid;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "层级")
    private Integer level;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "材料类型")
    private Integer materialtype;

    /**
     *  材料类型文本
     */
    @Transient
    @FieldEnumText(eum="Tp_procmaterial", valuefield="materialtype")
    private String materialtype_text;




    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("parentid", this.getParentid());
        map.put("name", this.getName());
        map.put("level", this.getLevel());
        map.put("sort", this.getSort());
        map.put("materialtype_text", this.materialtype_text);
        map.put("materialtype", this.getMaterialtype());
        return map;
    }

    public Integer getId() {
        return id;
    }

    @Override
    public void setId(Serializable id) {
        this.id = (Integer) id;
    }
    public Serializable getPrimaryKey() {
        return id;
        // return new Apl_decistiontypePK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (Integer) key;

        //Apl_decistiontypePK pk = (Apl_decistiontypePK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}